package pe.gob.sunarp.entidad;

import java.io.Serializable;
import javax.persistence.*;

/**
 * The primary key class for the USO_SERVICIO database table.
 * 
 */
@Embeddable
public class UsoServicioPK implements Serializable {
	//default serial version id, required for serializable classes.
	private static final long serialVersionUID = 1L;
	private long servicioId;
	private String codRegPub;
	private String codOficReg;
	private String aaaammdd;
	private String tipoUsr;
	private String fgInterno;
	private String regPubOrig;

    public UsoServicioPK() {
    }

	@Column(name="SERVICIO_ID", unique=true, nullable=false)
	public long getServicioId() {
		return this.servicioId;
	}
	public void setServicioId(long servicioId) {
		this.servicioId = servicioId;
	}

	@Column(name="COD_REG_PUB", unique=true, nullable=false, length=2)
	public String getCodRegPub() {
		return this.codRegPub;
	}
	public void setCodRegPub(String codRegPub) {
		this.codRegPub = codRegPub;
	}

	@Column(name="COD_OFIC_REG", unique=true, nullable=false, length=2)
	public String getCodOficReg() {
		return this.codOficReg;
	}
	public void setCodOficReg(String codOficReg) {
		this.codOficReg = codOficReg;
	}

	@Column(unique=true, nullable=false, length=8)
	public String getAaaammdd() {
		return this.aaaammdd;
	}
	public void setAaaammdd(String aaaammdd) {
		this.aaaammdd = aaaammdd;
	}

	@Column(name="TIPO_USR", unique=true, nullable=false, length=1)
	public String getTipoUsr() {
		return this.tipoUsr;
	}
	public void setTipoUsr(String tipoUsr) {
		this.tipoUsr = tipoUsr;
	}

	@Column(name="FG_INTERNO", unique=true, nullable=false, length=1)
	public String getFgInterno() {
		return this.fgInterno;
	}
	public void setFgInterno(String fgInterno) {
		this.fgInterno = fgInterno;
	}

	@Column(name="REG_PUB_ORIG", unique=true, nullable=false, length=2)
	public String getRegPubOrig() {
		return this.regPubOrig;
	}
	public void setRegPubOrig(String regPubOrig) {
		this.regPubOrig = regPubOrig;
	}

	public boolean equals(Object other) {
		if (this == other) {
			return true;
		}
		if (!(other instanceof UsoServicioPK)) {
			return false;
		}
		UsoServicioPK castOther = (UsoServicioPK)other;
		return 
			(this.servicioId == castOther.servicioId)
			&& this.codRegPub.equals(castOther.codRegPub)
			&& this.codOficReg.equals(castOther.codOficReg)
			&& this.aaaammdd.equals(castOther.aaaammdd)
			&& this.tipoUsr.equals(castOther.tipoUsr)
			&& this.fgInterno.equals(castOther.fgInterno)
			&& this.regPubOrig.equals(castOther.regPubOrig);

    }
    
	public int hashCode() {
		final int prime = 31;
		int hash = 17;
		hash = hash * prime + ((int) (this.servicioId ^ (this.servicioId >>> 32)));
		hash = hash * prime + this.codRegPub.hashCode();
		hash = hash * prime + this.codOficReg.hashCode();
		hash = hash * prime + this.aaaammdd.hashCode();
		hash = hash * prime + this.tipoUsr.hashCode();
		hash = hash * prime + this.fgInterno.hashCode();
		hash = hash * prime + this.regPubOrig.hashCode();
		
		return hash;
    }
}